<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>开始WebGL</title>
</head>
<body onload="main()">
    <canvas id="glcanvas" width="640" height="480">
        Your browser doesn't appear to support the HTML5 <code>&lt;canvas&gt;</code> element.
    </canvas>

<script type="text/javascript">
    function main(){
        const canvas = document.getElementById("glcanvas");
        const gl = canvas.getContext("webgl");

        if (!gl) {
            return alert("Unable to initialize WebGL. Your browser or machine may not support it.");
        }

        gl.clearColor(1.0, 0.0, 0.0, 0.4);
        gl.clear(gl.COLOR_BUFFER_BIT);
    }
</script>
</body>
</html>
